package org.example.factory;

import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import org.example.entity.Shape;
import org.example.entity.imple.Circle;
import org.example.entity.imple.Rectangle;
import org.example.entity.imple.Triangle;

@NoArgsConstructor
public class SimpleFactory {
    public static Shape drawShape(String shapeName) throws Exception {
        if(shapeName.equals("circle")){
            return new Circle();
        } else if (shapeName.equals("rectangle")) {
            return new Rectangle();
        } else if (shapeName.equals("triangle")) {
            return new Triangle();
        }else {
            throw new Exception("sorry,I can't draw this shape!");
        }
    }
}
